<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>类型转换</title>
    <script>
        //方法一 toString();
        var a1 = 19;
        console.log(typeof(a1));
        var b1 = a1.toString();
        console.log(typeof(b1));
        //方法二 String()
        var a2 = 10;
        console.log(typeof(a2));
        console.log(typeof(String(a2)));


        //方法三 拼接字符串 隐式转换 (常用)
        var a3 = 21;
        console.log(typeof(a3));
        console.log(typeof(a3 + ''));
    </script>
</head>

<body>

</body>

</html>